<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>事件</title>
    <script src="node_modules/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
    <button @click="sayHi">click me</button>
</div>
<script>
    var app = new Vue({
        el: "#app",
        data: {
            msg: "Hello"
        },
        methods: { // 方法必须定义在Ve的Methods对象中
            sayHi: function () {
                alert(this.msg)
            },
        }
    })
</script>
</body>
</html>